#include <iostream>
#define SIZE 50

using namespace std;

int main()
{
	int n, b, v[SIZE], p = -1, i;
	cout << "n = ";
	cin >> n;
	
	cout << "b = ";
	cin >> b;
	
	while (n != 0)
	{
		++p;
		v[p] = n % b;
		n /= b;
	}
	
	for (i = p; i >= 0; --i)
		cout << v[i];
	
	return 0;
}